setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 Economic Survey, study no. 7684")
library(dplyr)
library(tidyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s7684_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 7684
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- car::recode(survey$F1, "c('Male head', 'Female head (no male head)') = 'Yes';
c('Wife', 'Son', 'Daughter', 'Other (specify)') = 'No'; else = NA")
# increasing inequality (inequality) cannot find variable
# survey$inequality <- car::recode(survey$P7_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
survey$inequality <- NA
# inequality variable (inequality.variable)
# survey$inequality.variable <- 1
survey$inequality.variable <- NA
# union (union.self)
survey$union.self <- survey$F6_1 # already harmonized
# union (union.other)
survey$union.other <- survey$F6_2
# employment (employed)
survey$employed <- survey$F2A
# occupation
survey$occupation <- survey$F2B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- as.numeric(survey$F5)
survey$educ <- car::recode(survey$educ, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F7
# age
survey$age <- survey$F4
# race
survey$race <- survey$F9
# politics (party)
survey$party <- survey$P1C
# politics (ideology)
survey$ideology <- survey$P1K
# gender
survey$gender <- survey$F10
# religion
survey$religion <- survey$F8
# subset
survey_7684 <- survey[, c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_7684)
